If you want an extension var property, you just need to have both the custom getter and the custom setter, along with var in the declaration.

Note, though, that you are locked into the getter and setter having the same type. In this case, MutableMap naturally has different types for get and put operations: put() takes a T while get() returns a T?. You will need to find some way to coerce the result into the desired type — in this case, we throw an exception in case of a null response from the get() on MutableMap, so our custom getter will be inferred to return a T.

You can learn more about this in:
Run Edit